Optimal. Leaf size=167 \[ -\frac {b (a+b \cot (c+d x))^{1+n} \, _2F_1\left (1,1+n;2+n;\frac {a+b \cot (c+d x)}{a-\sqrt {-b^2}}\right )}{2 \sqrt {-b^2} \left (a-\sqrt {-b^2}\right ) d (1+n)}+\frac {b (a+b \cot (c+d x))^{1+n} \, _2F_1\left (1,1+n;2+n;\frac {a+b \cot (c+d x)}{a+\sqrt {-b^2}}\right )}{2 \sqrt {-b^2} \left (a+\sqrt {-b^2}\right ) d (1+n)} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.18, antiderivative size = 167, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 3, integrand size = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {3566, 726, 70}
\begin {gather*} \frac {b (a+b \cot (c+d x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac {a+b \cot (c+d x)}{a+\sqrt {-b^2}}\right )}{2 \sqrt {-b^2} d (n+1) \left (a+\sqrt {-b^2}\right )}-\frac {b (a+b \cot (c+d x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac {a+b \cot (c+d x)}{a-\sqrt {-b^2}}\right )}{2 \sqrt {-b^2} d (n+1) \left (a-\sqrt {-b^2}\right )} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 70
Rule 726
Rule 3566
Rubi steps
\begin {align*} \int (a+b \cot (c+d x))^n \, dx &=-\frac {b \text {Subst}\left (\int \frac {(a+x)^n}{b^2+x^2} \, dx,x,b \cot (c+d x)\right )}{d}\\ &=-\frac {b \text {Subst}\left (\int \left (\frac {\sqrt {-b^2} (a+x)^n}{2 b^2 \left (\sqrt {-b^2}-x\right )}+\frac {\sqrt {-b^2} (a+x)^n}{2 b^2 \left (\sqrt {-b^2}+x\right )}\right ) \, dx,x,b \cot (c+d x)\right )}{d}\\ &=\frac {b \text {Subst}\left (\int \frac {(a+x)^n}{\sqrt {-b^2}-x} \, dx,x,b \cot (c+d x)\right )}{2 \sqrt {-b^2} d}+\frac {b \text {Subst}\left (\int \frac {(a+x)^n}{\sqrt {-b^2}+x} \, dx,x,b \cot (c+d x)\right )}{2 \sqrt {-b^2} d}\\ &=-\frac {b (a+b \cot (c+d x))^{1+n} \, _2F_1\left (1,1+n;2+n;\frac {a+b \cot (c+d x)}{a-\sqrt {-b^2}}\right )}{2 \sqrt {-b^2} \left (a-\sqrt {-b^2}\right ) d (1+n)}+\frac {b (a+b \cot (c+d x))^{1+n} \, _2F_1\left (1,1+n;2+n;\frac {a+b \cot (c+d x)}{a+\sqrt {-b^2}}\right )}{2 \sqrt {-b^2} \left (a+\sqrt {-b^2}\right ) d (1+n)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.33, size = 118, normalized size = 0.71 \begin {gather*} \frac {(a+b \cot (c+d x))^{1+n} \left ((a+i b) \, _2F_1\left (1,1+n;2+n;\frac {a+b \cot (c+d x)}{a-i b}\right )-(a-i b) \, _2F_1\left (1,1+n;2+n;\frac {a+b \cot (c+d x)}{a+i b}\right )\right )}{2 (a-i b) (-i a+b) d (1+n)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 0.54, size = 0, normalized size = 0.00 \[\int \left (a +b \cot \left (d x +c \right )\right )^{n}\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \cot {\left (c + d x \right )}\right )^{n}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\left (a+b\,\mathrm {cot}\left (c+d\,x\right )\right )}^n \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________